package com.shelpe.services.lexicon.repository.mongo;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.shelpe.services.lexicon.constants.Origin;
import com.shelpe.services.lexicon.entity.KeywordRecommend;

public interface KeywordRecommendRepository extends PagingAndSortingRepository<KeywordRecommend, String> {

	Page<KeywordRecommend> findByAdgroupID(long adgroupID, Pageable page);
	List<KeywordRecommend> findByAdgroupRecordIDAndOrigin(String adgroupRecordID, Origin origin);
	List<KeywordRecommend> findByAdgroupRecordIDAndOrigin(String adgroupRecordID, Origin origin, Sort sort);
	List<KeywordRecommend> findByAdgroupRecordIDAndOriginIn(String adgroupRecordID, List<Origin> origins, Sort sort);
	Page<KeywordRecommend> findByAdgroupRecordIDAndOrigin(String adgroupRecordID, Origin origin, Pageable page);
	Page<KeywordRecommend> findByAdgroupIDAndOrigin(long adgroupID, Origin origin, Pageable page);
	
	KeywordRecommend findByAdgroupIDAndOriginAndWord(long adgroupID, Origin origin, String word);
	List<KeywordRecommend> findByAdgroupIDAndWordIn(long adgroupID, List<String> words);
	List<KeywordRecommend>  findByAdgroupID(long adgroupID);
	List<KeywordRecommend>  findByAdgroupRecordID(String adgroupRecordID);
	
	int countByAdgroupRecordID(String adgroupRecordID);
}
